// src/router/index.js
import { createRouter, createWebHashHistory } from 'vue-router'
import TodoList from '../components/TodoList.vue'
import Login from '../components/Login.vue'
import Register from '../components/Register.vue'

const routes = [
  { path: '/', redirect: '/todo' },
  { path: '/todo', name: 'TodoList', component: TodoList },
  { path: '/login', name: 'Login', component: Login },
  { path: '/register', name: 'Register', component: Register }
]

const router = createRouter({
  history: createWebHashHistory(), // ✅ 放在对象里
  routes                           // ✅ 同样放在对象里
})

export default router